import request from "@/utils/request";


/**
 * 列表查询文章分类
 */
export const articleCategoryService = () => {
    // 在pinia 中定义的响应式数据，都不需要.value
    return request.get("/category");
}

/**
 * 添加文章分类
 */
export const articleCategoryAddService = (categoryData) => {
    return request.post("/category", categoryData);
}

/**
 * 更新文章分类
 */
export const articleCategoryUpdateService = (categoryData) => {
    return request.put("/category", categoryData);
}

/**
 * 删除文章分类
 */
export const articleCategoryDeleteService = (id) => {
    return request.delete("/category?id=" + id);
}

/**
 * 文章列表查询
 */
export const articleListService = (params) => {
    return request.get("/article", {params: params});
}

/**
 * 发布文章
 */
export const articleAddService = (article) => {
    return request.post("/article", article);
}

/**
 * 获取文章详情
 */
export const articleDetailService = (id) => {
    return request.get("/article/detail?id=" + id);
}

/**
 * 更新文章
 */
export const articleUpdateService = (article) => {
    return request.put("/article", article)
}
/**
 * 删除文章
 */
export const articleDeleteService = (id) => {
    return request.delete("/article?id=" + id);
}
